package com.scwatch.core.repository;

import com.scwatch.core.domain.InfoDetail;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;

import java.util.List;

/**
 * InfoDetailDao
 * 
 * @author gjl
 * 
 */
public interface InfoDetailDao extends Repository<InfoDetail, Integer> {
	public InfoDetail findOne(Integer id);

	public InfoDetail save(InfoDetail bean);

    @Query(nativeQuery=true,value="SELECT * FROM cms_info_detail WHERE f_info_id IN ( SELECT DISTINCT f_fid FROM cms_comment WHERE f_ftype = 'Info' )")
//    @Query("SELECT * FROM Info  bean WHERE bean.id IN (SELECT DISTINCT beean1.fid FROM Comment beean1 WHERE beean1.ftype = 'Info')")
    public List<Object[]> queryCommentInfo();

}
